[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:18 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=c9ce746

The following commit has been merged in the master branch:
commit c9ce746eedf5740de402476fa39dcd622e4f13ed
Author: George Goldberg <george.goldberg at collabora.co.uk>
Date:   Mon Jan 3 17:31:38 2011 +0000

    Storage Test: add beginnings of a storage test, testing the constructor and destructor so far.
---
 kpeople/nepomuk-feeder/tests/CMakeLists.txt        |  10 ++
 kpeople/nepomuk-feeder/tests/storage-test.cpp      | 101 +++++++++++++++++++++
 .../{test-backdoors.h => tests/storage-test.h}     |  34 +++++--
 3 files changed, 136 insertions(+), 9 deletions(-)

diff --git a/kpeople/nepomuk-feeder/tests/CMakeLists.txt b/kpeople/nepomuk-feeder/tests/CMakeLists.txt
index b86d5e8..e4be21d 100644
--- a/kpeople/nepomuk-feeder/tests/CMakeLists.txt
+++ b/kpeople/nepomuk-feeder/tests/CMakeLists.txt
@@ -22,6 +22,16 @@ target_link_libraries(controller-test
 add_ktelepathy_dbus_test(ControllerTest ${CMAKE_CURRENT_BINARY_DIR}/controller-test)
 
 ################################
+# Storage test
+kde4_add_executable(storage-test storage-test.cpp)
+target_link_libraries(storage-test
+                      ${KTELEPATHYTESTLIB_LIBRARIES}
+                      ${QT_QTTEST_LIBRARY}
+                      nepomuktelepathyservice-static)
+add_ktelepathy_nepomuk_test(StorageTest ${CMAKE_CURRENT_BINARY_DIR}/storage-test)
+
+
+################################
 # Contact test
 #kde4_add_executable(contact-test contact-test.cpp)
 #target_link_libraries(contact-test tid-base-tests)
diff --git a/kpeople/nepomuk-feeder/tests/storage-test.cpp b/kpeople/nepomuk-feeder/tests/storage-test.cpp
new file mode 100644
index 0000000..fca4b66
--- /dev/null
+++ b/kpeople/nepomuk-feeder/tests/storage-test.cpp
@@ -0,0 +1,101 @@
+/*
+ * This file is part of telepathy-nepomuk-service
+ *
+ * Copyright (C) 2011 Collabora Ltd. <info at collabora.co.uk>
+ *   @author George Goldberg <george.goldberg at collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "storage-test.h"
+
+#include "test-backdoors.h"
+
+#include <KDebug>
+
+#include <qtest_kde.h>
+
+StorageTest::StorageTest(QObject *parent)
+: Test(parent),
+  m_storage(0)
+{
+    kDebug();
+}
+
+StorageTest::~StorageTest()
+{
+    kDebug();
+}
+
+void StorageTest::initTestCase()
+{
+    initTestCaseImpl();
+}
+
+void StorageTest::testConstructorDestructor()
+{
+    // First test constructing the NepomukStorage on a Nepomuk database with no relevant
+    // data already in it.
+    m_storage = new NepomukStorage(this);
+
+    // Check that the Nepomuk mePersonContact has been created.
+    QVERIFY(TestBackdoors::nepomukStorageMePersonContact(m_storage).exists());
+
+    // Check that the PersonContact and IMAccount lists are empty
+    QVERIFY(TestBackdoors::nepomukStorageAccounts(m_storage).isEmpty());
+    QVERIFY(TestBackdoors::nepomukStorageContacts(m_storage).isEmpty());
+
+    // Now destroy the NepomukStorage, running the event loop
+    // to make sure the destruction is completed.
+    connect(m_storage, SIGNAL(destroyed(QObject*)), mLoop, SLOT(quit()));
+    m_storage->deleteLater();
+    m_storage = 0;
+    QCOMPARE(mLoop->exec(), 0);
+
+    // Next, try constructing a NepomukStorage instance where the mePersonContact already exists.
+    m_storage = new NepomukStorage(this);
+
+    // Check that the Nepomuk mePersonContact has been created.
+    QVERIFY(TestBackdoors::nepomukStorageMePersonContact(m_storage).exists());
+
+    // Check that the PersonContact and IMAccount lists are empty
+    QVERIFY(TestBackdoors::nepomukStorageAccounts(m_storage).isEmpty());
+    QVERIFY(TestBackdoors::nepomukStorageContacts(m_storage).isEmpty());
+
+    // Now destroy the NepomukStorage, running the event loop
+    // to make sure the destruction is completed.
+    connect(m_storage, SIGNAL(destroyed(QObject*)), mLoop, SLOT(quit()));
+    m_storage->deleteLater();
+    m_storage = 0;
+    QCOMPARE(mLoop->exec(), 0);
+}
+
+void StorageTest::cleanupTestCase()
+{
+    cleanupTestCaseImpl();
+
+    // Clear re-used member variables.
+    if (m_storage) {
+        m_storage->deleteLater();
+        m_storage = 0;
+    }
+}
+
+
+QTEST_KDEMAIN(StorageTest, GUI)
+
+
+#include "storage-test.moc"
+
diff --git a/kpeople/nepomuk-feeder/test-backdoors.h b/kpeople/nepomuk-feeder/tests/storage-test.h
similarity index 60%
copy from kpeople/nepomuk-feeder/test-backdoors.h
copy to kpeople/nepomuk-feeder/tests/storage-test.h
index d6ec486..475377f 100644
--- a/kpeople/nepomuk-feeder/test-backdoors.h
+++ b/kpeople/nepomuk-feeder/tests/storage-test.h
@@ -1,7 +1,7 @@
 /*
- * This file is part of telepathy-nepomuk-service
+ * This file is part of nepomuktelepathyservice
  *
- * Copyright (C) 2010-2011 Collabora Ltd. <info at collabora.co.uk>
+ * Copyright (C) 2011 Collabora Ltd. <info at collabora.co.uk>
  *   @author George Goldberg <george.goldberg at collabora.co.uk>
  *
  * This library is free software; you can redistribute it and/or
@@ -19,18 +19,34 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef TELEPATHY_NEPOMUK_SERVICE_TEST_BACKDOORS_H
-#define TELEPATHY_NEPOMUK_SERVICE_TEST_BACKDOORS_H
+#ifndef TELEPATHY_NEPOMUK_SERVICE_STORAGE_TEST_H
+#define TELEPATHY_NEPOMUK_SERVICE_STORAGE_TEST_H
 
 #include "nepomuk-storage.h"
 
-class KDE_EXPORT TestBackdoors {
+#include <KTelepathy/TestLib/Test>
+
+class StorageTest : public Test
+{
+    Q_OBJECT
+
 public:
-    static Nepomuk::PersonContact nepomukStorageMePersonContact(NepomukStorage *storage);
-    static QHash<QString, Nepomuk::IMAccount>& nepomukStorageAccounts(NepomukStorage *storage);
-    static QHash<ContactIdentifier, ContactResources>& nepomukStorageContacts(NepomukStorage *storage);
+    StorageTest(QObject* parent = 0);
+    virtual ~StorageTest();
+
+public Q_SLOTS:
+
+private Q_SLOTS:
+    void initTestCase();
+
+    void testConstructorDestructor();
+
+    void cleanupTestCase();
+
+private:
+    NepomukStorage *m_storage;
 };
 
 
-#endif  // Header guard
+#endif  // Include guard
 

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list