Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 82115b35 authored by Laurent Montel's avatar Laurent Montel 😁

improve unittest

parent 1a46a7e2
......@@ -46,7 +46,8 @@ void AttachmentVcardFromAddressBookJobTest::testAttachmentVCardWithValidItem()
Akonadi::Item item(42);
item.setMimeType( KABC::Addressee::mimeType() );
KABC::Addressee address;
address.setName(QLatin1String("foo1"));
const QString name = QLatin1String("foo1");
address.setName(name);
item.setPayload<KABC::Addressee>( address );
MessageComposer::AttachmentVcardFromAddressBookJob *job = new MessageComposer::AttachmentVcardFromAddressBookJob(item);
QVERIFY(job->exec());
......@@ -56,17 +57,30 @@ void AttachmentVcardFromAddressBookJobTest::testAttachmentVCardWithValidItem()
job = 0;
QVERIFY( !part->data().isEmpty() );
QCOMPARE( part->mimeType(), QByteArray("text/x-vcard") );
const QString newName = name + QLatin1String(".vcf");
QCOMPARE( part->name(), newName );
QVERIFY( part->description().isEmpty() );
QVERIFY( !part->isInline() );
QVERIFY( !part->fileName().isEmpty() );
}
void AttachmentVcardFromAddressBookJobTest::testAttachmentVCardWithInvalidVCard()
{
Akonadi::Item item(42);
MessageComposer::AttachmentVcardFromAddressBookJob *job = new MessageComposer::AttachmentVcardFromAddressBookJob(item);
QVERIFY(!job->exec());
}
#if 0 //TODO
QCOMPARE( part->mimeType(), mimeType );
QCOMPARE( part->name(), name );
QCOMPARE( part->description(), description );
//QCOMPARE( part->charset(), charset ); // TODO will probably need charsets in AttachmentPart :(
QCOMPARE( part->fileName(), fileName );
QVERIFY( part->encoding() == encoding );
QVERIFY( part->isInline() );
QCOMPARE( part->data(), data );
#endif
void AttachmentVcardFromAddressBookJobTest::testAttachmentVCardWithEmptyVCard()
{
Akonadi::Item item(42);
item.setMimeType( KABC::Addressee::mimeType() );
KABC::Addressee address;
item.setPayload<KABC::Addressee>( address );
MessageComposer::AttachmentVcardFromAddressBookJob *job = new MessageComposer::AttachmentVcardFromAddressBookJob(item);
QVERIFY(job->exec());
//TODO
}
QTEST_KDEMAIN(AttachmentVcardFromAddressBookJobTest, GUI)
......@@ -32,6 +32,8 @@ public:
private Q_SLOTS:
void testAttachmentVCardWithInvalidItem();
void testAttachmentVCardWithValidItem();
void testAttachmentVCardWithInvalidVCard();
void testAttachmentVCardWithEmptyVCard();
};
#endif // ATTACHMENTVCARDFROMADDRESSBOOKJOBTEST_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment