Moving the proxy model test suite to kdesupport?

Stephen Kelly steveire at gmail.com
Sat Jul 3 14:13:08 BST 2010


Hi,

The test suite for proxy models is growing inside 
kdelibs/kdeui/tests/proxymodeltestsuite.

The unit tests for kselectionproxymodel and kdescendantsproxymodel depend on 
the test suite library.

Last week I added a ModelEventLogger which is useful for debugging model or 
proxy using applications, but as it is hidden inside kdeui/tests, the only 
way to use the logger is to hack the CMakeLists to find the library and 
headers.

kde-devel at bishop:~/kde/src/KDE/kdepim/kmail{master}$ git diff .
diff --git a/kmail/CMakeLists.txt b/kmail/CMakeLists.txt
index ee2fbd1..c1d89a1 100644
--- a/kmail/CMakeLists.txt
+++ b/kmail/CMakeLists.txt
@@ -33,6 +33,7 @@ include_directories(
   ${CMAKE_CURRENT_BINARY_DIR}/../ontologies
   ${NEPOMUK_INCLUDES}
   ${SOPRANO_INCLUDE_DIR}
+  /home/kde-devel/kde/src/KDE/kdelibs/kdeui/tests/proxymodeltestsuite
  )
 
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
@@ -252,6 +253,7 @@ target_link_libraries(kmailprivate
   ${QT_QTWEBKIT_LIBRARY}
   ${NEPOMUK_LIBRARIES}
   ${NEPOMUK_QUERY_LIBRARIES}
+  /home/kde-devel/kde/build/KDE/kdelibs/lib/libproxymodeltestsuite.so
 )
 
 set_target_properties(kmailprivate
diff --git a/kmail/kmkernel.cpp b/kmail/kmkernel.cpp
index 4abf35a..b828e00 100644
--- a/kmail/kmkernel.cpp
+++ b/kmail/kmkernel.cpp
@@ -108,6 +108,8 @@ using KMail::MailServiceImpl;
 
 #include "searchdescriptionattribute.h"
 
+#include "modeleventlogger.h"
+
 static KMKernel * mySelf = 0;
 static bool s_askingToGoOnline = false;
 
@@ -233,6 +235,8 @@ KMKernel::KMKernel (QObject *parent, const char *name) :
   mEntityTreeModel->setIncludeUnsubscribed( false );
   mEntityTreeModel->setItemPopulationStrategy( 
Akonadi::EntityTreeModel::LazyPopulation );
 
+  new ModelEventLogger(mEntityTreeModel, this);
+
   mCollectionModel = new Akonadi::EntityMimeTypeFilterModel( this );
   mCollectionModel->setSourceModel( mEntityTreeModel );
   mCollectionModel->addMimeTypeInclusionFilter( 
Akonadi::Collection::mimeType() );


I was thinking of moving the already self-contained proxymodeltestsuite 
library into kdesupport.

The library would be a build-time dependency for kdelibs and is needed only 
when tests are being built. 

The disadvantage is that people wishing to build kdelibs tests would need to 
build this external dependency. The advantage is that people hitting an 
assert in kmail etc would just need to install the library from a well known 
location, include the header and attach the logger. The library would not 
need to be packaged or versioned as far as I'm concerned. The 
proxymodeltestsuite library depends on Qt and my Grantlee templating system.

Any thoughts?

Steve.

PS, for more on this, attend my talk in room 1 this afternoon at Akademy :).






More information about the kde-core-devel mailing list