mpdata/tsrc/unittest_mpcollectiondatamodel/src/unittest_mpcollectiondatamodel.cpp
changeset 51 560ce2306a17
parent 35 fdb31ab341af
child 55 f3930dda3342
equal deleted inserted replaced
47:4cc1412daed0 51:560ce2306a17
    28 
    28 
    29 #include "unittest_mpcollectiondatamodel.h"
    29 #include "unittest_mpcollectiondatamodel.h"
    30 #include "unittest_helper.h"
    30 #include "unittest_helper.h"
    31 #include "stub/inc/mpcollectionalbumartmanager.h"
    31 #include "stub/inc/mpcollectionalbumartmanager.h"
    32 #include "stub/inc/mpmpxcollectiondata.h"
    32 #include "stub/inc/mpmpxcollectiondata.h"
       
    33 #include "stub/inc/mpplaybackdata.h"
    33 
    34 
    34 // Do this so we can access all member variables.
    35 // Do this so we can access all member variables.
    35 #define private public
    36 #define private public
    36 #include "mpcollectiondatamodel.h"
    37 #include "mpcollectiondatamodel.h"
    37 #undef private
    38 #undef private
    56 
    57 
    57 TestMpCollectionDataModel::TestMpCollectionDataModel()
    58 TestMpCollectionDataModel::TestMpCollectionDataModel()
    58     : mTest(0),
    59     : mTest(0),
    59       mHelper(0),
    60       mHelper(0),
    60       mStubData(0),
    61       mStubData(0),
       
    62       mStubPlaybackData(0),
    61       mMpTranslator(0)
    63       mMpTranslator(0)
    62 {
    64 {
    63 }
    65 }
    64 
    66 
    65 TestMpCollectionDataModel::~TestMpCollectionDataModel()
    67 TestMpCollectionDataModel::~TestMpCollectionDataModel()
    66 {
    68 {
    67     delete mTest;
    69     delete mTest;
    68     delete mHelper;
    70     delete mHelper;
    69     delete mStubData;
    71     delete mStubData;
       
    72     delete mStubPlaybackData;
    70     delete mMpTranslator;
    73     delete mMpTranslator;
    71 }
    74 }
    72 
    75 
    73 /*!
    76 /*!
    74  Called before the first testfunction is executed.
    77  Called before the first testfunction is executed.
    84     if ( translatorLoaded ) {
    87     if ( translatorLoaded ) {
    85         qApp->installTranslator(mMpTranslator);
    88         qApp->installTranslator(mMpTranslator);
    86     }
    89     }
    87 
    90 
    88     mStubData = new MpMpxCollectionData();
    91     mStubData = new MpMpxCollectionData();
       
    92     mStubPlaybackData = new MpPlaybackData(this);
    89     mHelper = new TestHelper();
    93     mHelper = new TestHelper();
    90 }
    94 }
    91 
    95 
    92 /*!
    96 /*!
    93  Called after the last testfunction was executed.
    97  Called after the last testfunction was executed.
    94  */
    98  */
    95 void TestMpCollectionDataModel::cleanupTestCase()
    99 void TestMpCollectionDataModel::cleanupTestCase()
    96 {
   100 {
    97     delete mStubData;
   101     delete mStubData;
    98     mStubData = 0;
   102     mStubData = 0;
       
   103     delete mStubPlaybackData;
       
   104     mStubPlaybackData = 0;
    99     delete mHelper;
   105     delete mHelper;
   100     mHelper = 0;
   106     mHelper = 0;
   101 }
   107 }
   102 
   108 
   103 /*!
   109 /*!
   104  Called before each testfunction is executed.
   110  Called before each testfunction is executed.
   105  */
   111  */
   106 void TestMpCollectionDataModel::init()
   112 void TestMpCollectionDataModel::init()
   107 {
   113 {
   108     mTest = new MpCollectionDataModel(mStubData);
   114     mTest = new MpCollectionDataModel(mStubData, mStubPlaybackData);
   109     MpMpxCollectionData::resetItemDataCounter();
   115     MpMpxCollectionData::resetItemDataCounter();
   110     mTest->mCollectionData->mItemDataReturn = true;
   116     mTest->mCollectionData->mItemDataReturn = true;
   111     mTest->mCollectionData->mCollectionTitleReturn = true;
   117     mTest->mCollectionData->mCollectionTitleReturn = true;
   112 }
   118 }
   113 
   119 
   964     QCOMPARE(mTest->mAlbumIndexOffset, 0);
   970     QCOMPARE(mTest->mAlbumIndexOffset, 0);
   965     mTest->mCollectionData->setContext(ECollectionContextPlaylistSongs);
   971     mTest->mCollectionData->setContext(ECollectionContextPlaylistSongs);
   966     QCOMPARE(mTest->mAlbumIndexOffset, 0);
   972     QCOMPARE(mTest->mAlbumIndexOffset, 0);
   967 }
   973 }
   968 
   974 
       
   975 /*!
       
   976  Tests fileCorrupted()
       
   977  */
       
   978 void TestMpCollectionDataModel::testFileCorrupted()
       
   979 {
       
   980     
       
   981     
       
   982 }
       
   983 
   969 // End of file
   984 // End of file