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

List:       kde-commits
Subject:    KDE/kdelibs/nepomuk/test
From:       Vishesh Handa <handa.vish () gmail ! com>
Date:       2010-07-10 18:53:36
Message-ID: 20100710185336.3C942AC867 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1148462 by vhanda:

Added a test to check if the properties are removed from the kickoff lists of \
ResourceData when removing the properties from the Resource.


 M  +74 -0     resourcetest.cpp  
 M  +1 -0      resourcetest.h  


--- trunk/KDE/kdelibs/nepomuk/test/resourcetest.cpp #1148461:1148462
@@ -350,6 +350,80 @@
     ResourceManager::instance()->clearCache();
 }
 
+
+void ResourceTest::testKickOffListRemoval()
+{
+    {
+        KTemporaryFile tmpFile1;
+        QVERIFY( tmpFile1.open() );
+
+        Resource fileRes( KUrl(tmpFile1.fileName()) );
+        fileRes.setRating( 4 );
+
+        // make sure the nie:url is saved
+        QVERIFY( ResourceManager::instance()->mainModel()->containsAnyStatement( \
fileRes.resourceUri(), Nepomuk::Vocabulary::NIE::url(), KUrl(tmpFile1.fileName()) ) \
); +
+        // make sure a proper nepomuk:/ uri has been created
+        QVERIFY( fileRes.resourceUri().scheme() == QLatin1String("nepomuk") );
+        
+        // Remove the nie:url
+        fileRes.removeProperty( Nepomuk::Vocabulary::NIE::url() );
+        
+        Resource fileRes2( KUrl(tmpFile1.fileName()) );
+        QVERIFY( fileRes.resourceUri() != fileRes2.resourceUri() );
+        
+        Resource r1( "res1" );
+        r1.setProperty( QUrl("http://test/prop1"), 42 );        
+        r1.removeProperty( Soprano::Vocabulary::NAO::identifier() );
+        
+        Resource r2( "res1" );
+        r2.setProperty( QUrl("http://test/prop1"), 46 );
+        
+        QVERIFY( r2.resourceUri() != r1.resourceUri() );
+        QVERIFY( r1.property(QUrl("http://test/prop1")) != \
r2.property(QUrl("http://test/prop1")) ); +            
+    }
+    {
+        KTemporaryFile tmpFile;
+        QVERIFY( tmpFile.open() );
+
+        Resource fileRes( KUrl(tmpFile.fileName()) );
+        fileRes.setRating( 4 );
+
+        // make sure the nie:url is saved
+        QVERIFY( ResourceManager::instance()->mainModel()->containsAnyStatement( \
fileRes.resourceUri(), Nepomuk::Vocabulary::NIE::url(), KUrl(tmpFile.fileName()) ) ); \
+ +        // make sure a proper nepomuk:/ uri has been created
+        QVERIFY( fileRes.resourceUri().scheme() == QLatin1String("nepomuk") );
+        
+        // Add a different the nie:url
+        KTemporaryFile tmpFile2;
+        QVERIFY( tmpFile2.open() );
+        fileRes.setProperty( Nepomuk::Vocabulary::NIE::url(), \
KUrl(tmpFile2.fileName()) ); +        
+        Resource fileRes2( KUrl(tmpFile.fileName()) );
+        QVERIFY( fileRes.resourceUri() != fileRes2.resourceUri() );
+        
+        Resource fileRes3( KUrl(tmpFile2.fileName()) );
+        QVERIFY( fileRes3.resourceUri() == fileRes.resourceUri() );
+        
+        Resource r1( "res1" );
+        r1.setProperty( QUrl("http://test/prop1"), 42 );
+        
+        r1.setProperty( Soprano::Vocabulary::NAO::identifier(), "foo" );
+        
+        Resource r2( "res1" );
+        r2.setProperty( QUrl("http://test/prop1"), 46 );
+        
+        QVERIFY( r2.resourceUri() != r1.resourceUri() );
+        QVERIFY( r1.property(QUrl("http://test/prop1")) != \
r2.property(QUrl("http://test/prop1")) ); +        
+        Resource r3( "foo" );
+        QVERIFY( r3.resourceUri() == r1.resourceUri() );
+    }
+
+}
+
 QTEST_KDEMAIN(ResourceTest, NoGUI)
 
 #include "resourcetest.moc"
--- trunk/KDE/kdelibs/nepomuk/test/resourcetest.h #1148461:1148462
@@ -28,6 +28,7 @@
     void testResourceIdentifiers();
     void testResourceManager();
     void testLocalFileUrls();
+    void testKickOffListRemoval();
 };
 
 #endif


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

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