[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:07:15 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=7388bc1
The following commit has been merged in the master branch:
commit 7388bc141f1bd4858cbe34c42a681329885d9255
Author: George Goldberg <george.goldberg at collabora.co.uk>
Date: Tue Jan 4 13:23:59 2011 +0000
Storage Test: add test case for the destroy-contact method.
---
kpeople/nepomuk-feeder/tests/storage-test.cpp | 66 +++++++++++++++++++++++++++
kpeople/nepomuk-feeder/tests/storage-test.h | 2 +-
2 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/kpeople/nepomuk-feeder/tests/storage-test.cpp b/kpeople/nepomuk-feeder/tests/storage-test.cpp
index 761a891..929aaee 100644
--- a/kpeople/nepomuk-feeder/tests/storage-test.cpp
+++ b/kpeople/nepomuk-feeder/tests/storage-test.cpp
@@ -489,6 +489,72 @@ void StorageTest::testCreateContact()
pC5.remove();
}
+void StorageTest::testDestroyContact()
+{
+ // Create the Storage.
+ m_storage = new NepomukStorage(this);
+ QVERIFY(m_storage);
+
+ QHash<QString, Nepomuk::IMAccount> *accounts = TestBackdoors::nepomukStorageAccounts(m_storage);
+ QHash<ContactIdentifier, ContactResources> *contacts = TestBackdoors::nepomukStorageContacts(m_storage);
+
+ // Create an account on the storage.
+ m_storage->createAccount(QLatin1String("/foo/bar/baz"),
+ QLatin1String("foo at bar.baz"),
+ QLatin1String("test"));
+
+ // Check the Account is created
+ QCOMPARE(TestBackdoors::nepomukStorageAccounts(m_storage)->size(), 1);
+ QCOMPARE(TestBackdoors::nepomukStorageContacts(m_storage)->size(), 0);
+
+ // And in Nepomuk...
+ Nepomuk::IMAccount imAcc1 = accounts->value(QLatin1String("/foo/bar/baz"));
+ QVERIFY(imAcc1.exists());
+ QCOMPARE(imAcc1.isAccessedByOf().size(), 0);
+
+ // Create a contact
+ m_storage->createContact(QLatin1String("/foo/bar/baz"),
+ QLatin1String("test at remote-contact.com"));
+
+ // Check the Contact is created.
+ QCOMPARE(TestBackdoors::nepomukStorageAccounts(m_storage)->size(), 1);
+ QCOMPARE(TestBackdoors::nepomukStorageContacts(m_storage)->size(), 1);
+
+ // Check its identifier is correct.
+ ContactIdentifier cId2(QLatin1String("/foo/bar/baz"), QLatin1String("test at remote-contact.com"));
+ QVERIFY(contacts->contains(cId2));
+
+ // Check the Nepomuk resources are created correctly.
+ ContactResources cRes2 = contacts->value(cId2);
+ Nepomuk::IMAccount imAcc2 = cRes2.imAccount();
+ Nepomuk::PersonContact pC2 = cRes2.personContact();
+ QVERIFY(imAcc2.exists());
+ QVERIFY(pC2.exists());
+
+ // Now destroy the contact
+ m_storage->destroyContact(QLatin1String("/foo/bar/baz"),
+ QLatin1String("test at remote-contact.com"));
+
+ // The contact should still be in the list
+ QCOMPARE(TestBackdoors::nepomukStorageAccounts(m_storage)->size(), 1);
+ QCOMPARE(TestBackdoors::nepomukStorageContacts(m_storage)->size(), 1);
+ QVERIFY(contacts->contains(cId2));
+
+ // And still in Nepomuk
+ QVERIFY(imAcc2.exists());
+ QVERIFY(pC2.exists());
+
+ // It's presence should be unknown now
+ QCOMPARE(imAcc2.imStatus(), QLatin1String("unknown"));
+ QCOMPARE(imAcc2.statusTypes().size(), 1);
+ QCOMPARE(imAcc2.statusTypes().first(), (long long)Tp::ConnectionPresenceTypeUnknown);
+
+ // Cleanup Nepomuk Resources used in this test
+ imAcc1.remove();
+ imAcc2.remove();
+ pC2.remove();
+}
+
void StorageTest::cleanupTestCase()
{
cleanupTestCaseImpl();
diff --git a/kpeople/nepomuk-feeder/tests/storage-test.h b/kpeople/nepomuk-feeder/tests/storage-test.h
index 800badb..aced8ac 100644
--- a/kpeople/nepomuk-feeder/tests/storage-test.h
+++ b/kpeople/nepomuk-feeder/tests/storage-test.h
@@ -45,7 +45,7 @@ private Q_SLOTS:
void testSetAccountNickname();
void testSetAccountCurrentPresence();
void testCreateContact();
-// void testDestroyContact();
+ void testDestroyContact();
// void testSetContactAlias();
// void testSetContactPresence();
// void testSetContactBlockedStatus();
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list