videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp
changeset 52 e3cecb93e76a
parent 47 45e72b57a2fd
child 59 a76e86df7ccd
--- a/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp	Tue Jul 06 14:17:50 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp	Wed Aug 18 09:50:14 2010 +0300
@@ -15,7 +15,9 @@
 * 
 */
 
+#include <qdebug.h>
 #include <qapplication.h>
+#include "xqsettingsmanagerstub.h"
 #include <vcxmyvideosdefs.h>
 #include "centralrepository.h"
 #include "testvideocollectionviewutils.h"
@@ -31,6 +33,7 @@
 #include "hblistview.h"
 #include <hbactivitymanager.h>
 #include <hbapplication.h>
+#include <xqsettingsmanagerstub.h>
 
 #define private public
 #include "videocollectionviewutils.h"
@@ -375,7 +378,9 @@
 // -----------------------------------------------------------------------------
 //
 void TestVideoVideoCollectionViewUtils::testLoadSortingValues()
-{      
+{
+    CRepository::setSetFail(255);
+
     CRepository::mSortValues[KVideoSortingRoleKey] = VideoCollectionCommon::KeyDateTime;
     CRepository::mSortValues[KVideoSortingOrderKey] = Qt::DescendingOrder;
     CRepository::mSortValues[KCollectionsSortingRoleKey] = VideoCollectionCommon::KeyTitle;
@@ -518,60 +523,37 @@
 }
 
 // -----------------------------------------------------------------------------
-// testGetServiceIconStrings
+// testGetCenRepStringValue
 // -----------------------------------------------------------------------------
 //
-void TestVideoVideoCollectionViewUtils::testGetServiceIconStrings()
-{
+void TestVideoVideoCollectionViewUtils::testGetCenRepStringValue()
+{  
     VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
-    CRepository::setNewLLeave(true);
-    _LIT(KExpectedTDesValue, "expected");
-    CRepository::setTDesValue(KExpectedTDesValue());
-    QString expected((QChar*)KExpectedTDesValue().Ptr(),KExpectedTDesValue().Length());
-    
-    QString icon;
-    QString pressed;
-    QVERIFY(testObject.getServiceIconStrings(icon, pressed) < 0);
-    QVERIFY(icon.isNull());
-    QVERIFY(pressed.isNull());
+
+    // Invalid
+    XQSettingsManager::mReadItemValueReturnValue = QVariant();
+    QVERIFY(testObject.getCenRepStringValue(0) == "");
     
-    CRepository::setNewLLeave(false);
-    CRepository::setGetFail(0);
-    QVERIFY(testObject.getServiceIconStrings(icon, pressed) < 0);
-    QVERIFY(icon.isNull());
-    QVERIFY(pressed.isNull());
-    
-    CRepository::setGetFail(1);
-    QVERIFY(testObject.getServiceIconStrings(icon, pressed) < 0);
-    QVERIFY(icon.isNull());
-    QVERIFY(pressed.isNull());
-    
-    CRepository::setGetFail(255);
-    QVERIFY(testObject.getServiceIconStrings(icon, pressed) == 0);
-    QCOMPARE(icon, expected);
-    QCOMPARE(pressed, expected);
+    // Ok
+    XQSettingsManager::mReadItemValueReturnValue = QVariant("test");
+    QVERIFY(testObject.getCenRepStringValue(0) == "test");
 }
 
 // -----------------------------------------------------------------------------
-// testGetServiceIconStrings
+// testGetCenRepIntValue
 // -----------------------------------------------------------------------------
 //
-void TestVideoVideoCollectionViewUtils::testGetServiceUriString()
-{
-     VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
-    CRepository::setNewLLeave(true);
-    _LIT(KExpectedTDesValue, "expected");
-    CRepository::setTDesValue(KExpectedTDesValue());
-    QString expected((QChar*)KExpectedTDesValue().Ptr(),KExpectedTDesValue().Length());
+void TestVideoVideoCollectionViewUtils::testGetCenRepIntValue()
+{   
+    VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
+
+    // Invalid
+    XQSettingsManager::mReadItemValueReturnValue = QVariant();
+    QVERIFY(testObject.getCenRepIntValue(0) == -1);
     
-    QVERIFY(testObject.getServiceUriString().isNull());
-    
-    CRepository::setNewLLeave(false);
-    CRepository::setGetFail(0);
-    QVERIFY(testObject.getServiceUriString().isNull());
-    
-    CRepository::setGetFail(255);
-    QCOMPARE(testObject.getServiceUriString(), expected);
+    // Ok
+    XQSettingsManager::mReadItemValueReturnValue = QVariant(13);
+    QVERIFY(testObject.getCenRepIntValue(0) == 13);
 }
 
 // -----------------------------------------------------------------------------
@@ -641,6 +623,8 @@
 //
 void TestVideoVideoCollectionViewUtils::testSortModel()
 {
+    CRepository::setGetFail(255);
+    
     VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
     testObject.mVideosSortRole = -1;
     testObject.mVideosSortOrder = Qt::AscendingOrder;
@@ -797,6 +781,3 @@
 }
 
 // End of file
-    
-
-