[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/pim/krss/resource
From:       Dmitry Ivanov <vonami () gmail ! com>
Date:       2008-08-18 18:04:25
Message-ID: 1219082665.133023.1859.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 848923 by divanov:

 - add tests for ImportOpmlJob
 - fix bugs catched by the tests:
   - correctly parse mixed OPMLv2 'category' elements
   - don't add a tag twice


 M  +9 -2      importopmljob.cpp  
 M  +7 -0      tests/CMakeLists.txt  
 A             tests/importopmljobtest.cpp   [License: GPL (v2+)]
 A             tests/importopmljobtest.h   [License: GPL (v2+)]
 A             tests/testdata (directory)  
 A             tests/testdata/broken.opml  
 A             tests/testdata/good.opml  


--- trunk/playground/pim/krss/resource/importopmljob.cpp #848922:848923
@@ -284,7 +284,9 @@
         if ( !attributeValue( d->m_reader.attributes(), "text" ).isEmpty() ) {
             // this is an Akregator's folder
             isFolder = true;
-            tags << attributeValue( d->m_reader.attributes(), "text" ).toString();
+            if ( !tags.contains( attributeValue( d->m_reader.attributes(), "text" \
).toString() ) ) +                tags.append( attributeValue( \
d->m_reader.attributes(), "text" ).toString() ); +
             kDebug() << "Tags:" << tags;
         }
         else {
@@ -320,7 +322,12 @@
 
         // add tags from the 'category' attribute (OPML v2)
         if ( !attributeValue( d->m_reader.attributes(), "category" ).isEmpty() ) {
-            tags += attributeValue( d->m_reader.attributes(), "category" \
).toString().split( ',' ); +            QStringList categories = attributeValue( \
d->m_reader.attributes(), "category" ).toString(). +                                  \
split( QRegExp( "[,/]" ), QString::SkipEmptyParts ); +            Q_FOREACH( const \
QString &category, categories ) { +                if ( !tags.contains( category ) )
+                    tags.append( category );
+            }
         }
 
         // set feed tags
--- trunk/playground/pim/krss/resource/tests/CMakeLists.txt #848922:848923
@@ -5,6 +5,13 @@
     ${CMAKE_CURRENT_SOURCE_DIR}/../
 )
 
+# path to test data
+add_definitions(-DTESTDATAPATH=\\"${CMAKE_CURRENT_SOURCE_DIR}/testdata\\")
+
 # rssitemsynctest
 kde4_add_unit_test(rssitemsynctest rssitemsynctest.cpp ../rssitemsync.cpp)
 target_link_libraries(rssitemsynctest ${QT_QTTEST_LIBRARY} krss)
+
+# importopmljobtest
+kde4_add_unit_test(importopmljobtest importopmljobtest.cpp ../importopmljob.cpp)
+target_link_libraries(importopmljobtest ${QT_QTTEST_LIBRARY} krss)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic