videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp
changeset 50 21fe8338c6bf
parent 44 518105d52e45
child 55 4bfa887905cf
equal deleted inserted replaced
49:824471cb468a 50:21fe8338c6bf
    13 *
    13 *
    14 * Description:   tester for methods in VideoCollectionViewUtils
    14 * Description:   tester for methods in VideoCollectionViewUtils
    15 * 
    15 * 
    16 */
    16 */
    17 
    17 
       
    18 #include <qdebug.h>
    18 #include <qapplication.h>
    19 #include <qapplication.h>
    19 #include "xqsettingsmanagerstub.h"
    20 #include "xqsettingsmanagerstub.h"
    20 #include <vcxmyvideosdefs.h>
    21 #include <vcxmyvideosdefs.h>
    21 #include "centralrepository.h"
    22 #include "centralrepository.h"
    22 #include "testvideocollectionviewutils.h"
    23 #include "testvideocollectionviewutils.h"
    30 #include "hbmessageboxdata.h"
    31 #include "hbmessageboxdata.h"
    31 #include "hbnotificationdialog.h"
    32 #include "hbnotificationdialog.h"
    32 #include "hblistview.h"
    33 #include "hblistview.h"
    33 #include <hbactivitymanager.h>
    34 #include <hbactivitymanager.h>
    34 #include <hbapplication.h>
    35 #include <hbapplication.h>
       
    36 #include <xqsettingsmanagerstub.h>
    35 
    37 
    36 #define private public
    38 #define private public
    37 #include "videocollectionviewutils.h"
    39 #include "videocollectionviewutils.h"
    38 #undef private
    40 #undef private
    39 
    41 
   374 // -----------------------------------------------------------------------------
   376 // -----------------------------------------------------------------------------
   375 // testLoadSortingValues
   377 // testLoadSortingValues
   376 // -----------------------------------------------------------------------------
   378 // -----------------------------------------------------------------------------
   377 //
   379 //
   378 void TestVideoVideoCollectionViewUtils::testLoadSortingValues()
   380 void TestVideoVideoCollectionViewUtils::testLoadSortingValues()
   379 {      
   381 {
       
   382     CRepository::setSetFail(255);
       
   383 
   380     CRepository::mSortValues[KVideoSortingRoleKey] = VideoCollectionCommon::KeyDateTime;
   384     CRepository::mSortValues[KVideoSortingRoleKey] = VideoCollectionCommon::KeyDateTime;
   381     CRepository::mSortValues[KVideoSortingOrderKey] = Qt::DescendingOrder;
   385     CRepository::mSortValues[KVideoSortingOrderKey] = Qt::DescendingOrder;
   382     CRepository::mSortValues[KCollectionsSortingRoleKey] = VideoCollectionCommon::KeyTitle;
   386     CRepository::mSortValues[KCollectionsSortingRoleKey] = VideoCollectionCommon::KeyTitle;
   383     CRepository::mSortValues[KCollectionsSortingOrderKey] = Qt::DescendingOrder;
   387     CRepository::mSortValues[KCollectionsSortingOrderKey] = Qt::DescendingOrder;
   384     
   388     
   522 // testGetCenRepStringValue
   526 // testGetCenRepStringValue
   523 // -----------------------------------------------------------------------------
   527 // -----------------------------------------------------------------------------
   524 //
   528 //
   525 void TestVideoVideoCollectionViewUtils::testGetCenRepStringValue()
   529 void TestVideoVideoCollectionViewUtils::testGetCenRepStringValue()
   526 {  
   530 {  
   527     
   531     VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
       
   532 
       
   533     // Invalid
       
   534     XQSettingsManager::mReadItemValueReturnValue = QVariant();
       
   535     QVERIFY(testObject.getCenRepStringValue(0) == "");
       
   536     
       
   537     // Ok
       
   538     XQSettingsManager::mReadItemValueReturnValue = QVariant("test");
       
   539     QVERIFY(testObject.getCenRepStringValue(0) == "test");
   528 }
   540 }
   529 
   541 
   530 // -----------------------------------------------------------------------------
   542 // -----------------------------------------------------------------------------
   531 // testGetCenRepIntValue
   543 // testGetCenRepIntValue
   532 // -----------------------------------------------------------------------------
   544 // -----------------------------------------------------------------------------
   533 //
   545 //
   534 void TestVideoVideoCollectionViewUtils::testGetCenRepIntValue()
   546 void TestVideoVideoCollectionViewUtils::testGetCenRepIntValue()
   535 {   
   547 {   
   536     
   548     VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
       
   549 
       
   550     // Invalid
       
   551     XQSettingsManager::mReadItemValueReturnValue = QVariant();
       
   552     QVERIFY(testObject.getCenRepIntValue(0) == -1);
       
   553     
       
   554     // Ok
       
   555     XQSettingsManager::mReadItemValueReturnValue = QVariant(13);
       
   556     QVERIFY(testObject.getCenRepIntValue(0) == 13);
   537 }
   557 }
   538 
   558 
   539 // -----------------------------------------------------------------------------
   559 // -----------------------------------------------------------------------------
   540 // testInitListView
   560 // testInitListView
   541 // -----------------------------------------------------------------------------
   561 // -----------------------------------------------------------------------------
   601 // testSortModel
   621 // testSortModel
   602 // -----------------------------------------------------------------------------
   622 // -----------------------------------------------------------------------------
   603 //
   623 //
   604 void TestVideoVideoCollectionViewUtils::testSortModel()
   624 void TestVideoVideoCollectionViewUtils::testSortModel()
   605 {
   625 {
       
   626     CRepository::setGetFail(255);
       
   627     
   606     VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
   628     VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
   607     testObject.mVideosSortRole = -1;
   629     testObject.mVideosSortRole = -1;
   608     testObject.mVideosSortOrder = Qt::AscendingOrder;
   630     testObject.mVideosSortOrder = Qt::AscendingOrder;
   609     testObject.mCollectionsSortRole = -1;
   631     testObject.mCollectionsSortRole = -1;
   610     testObject.mCollectionsSortOrder = Qt::AscendingOrder;
   632     testObject.mCollectionsSortOrder = Qt::AscendingOrder;
   757     QVERIFY(name == "name");
   779     QVERIFY(name == "name");
   758    
   780    
   759 }
   781 }
   760 
   782 
   761 // End of file
   783 // End of file
   762     
       
   763 
       
   764