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

List:       kde-commits
Subject:    playground/pim/krss/resources/libkrssresource/tests
From:       Dmitry Ivanov <vonami () gmail ! com>
Date:       2009-04-04 13:29:02
Message-ID: 1238851742.540538.16695.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 949082 by divanov:

Test that the import job doesn't create duplicate tags.


 M  +29 -0     importopmljobtest.cpp  
 M  +1 -0      importopmljobtest.h  


--- trunk/playground/pim/krss/resources/libkrssresource/tests/importopmljobtest.cpp \
#949081:949082 @@ -166,6 +166,35 @@
     }
 }
 
+void ImportOpmlJobTest::testImportDuplicates()
+{
+    const QString defaultTag = "Imported-dups";
+    const QString kdehome = qgetenv( "KDEHOME" );
+    org::kde::krss *interface = new org::kde::krss( \
"org.freedesktop.Akonadi.Resource.akonadi_opml_rss_resource_0", +                     \
"/KRss", QDBusConnection::sessionBus(), this ); +
+    QDBusReply<QVariantMap> reply = interface->call( "importOpml", kdehome + \
"/to-import-duplicates.opml", +                                                     \
defaultTag ); +    QVERIFY( reply.isValid() );
+    QVERIFY( reply.value().value( "error" ).toInt() == 0 );
+
+    // test that 'Imported-dups' and 'OSS' tags were created correctly
+    // and 'Linux' was not created
+    TagProviderRetrieveJob *tjob = new TagProviderRetrieveJob();
+    QVERIFY( tjob->exec() );
+    const TagProvider * const tagProvider = tjob->tagProvider();
+    const QHash<TagId, Tag> allTags = tagProvider->tags();
+    QCOMPARE( allTags.size(), 8 );
+    QHashIterator<TagId, Tag> it( allTags );
+    QStringList tagLabels;
+    while ( it.hasNext() ) {
+        it.next();
+        tagLabels.append( it.value().label() );
+    }
+    compareLists( tagLabels, QStringList() << "Imported" << "Linux" << "Planets" << \
"Ubuntu" << "News" +                                           << "Technology" << \
"Imported-dups" << "OSS" ); +}
+
 void ImportOpmlJobTest::testBrokenOpml()
 {
     const QString defaultTag = "Imported";
--- trunk/playground/pim/krss/resources/libkrssresource/tests/importopmljobtest.h \
#949081:949082 @@ -26,6 +26,7 @@
 private Q_SLOTS:
     void initTestCase();
     void testGoodOpml();
+    void testImportDuplicates();
     void testBrokenOpml();
 };
 


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

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